# -*- coding: utf-8 -*-
"""
@Time ： 2024/2/29 16:32
@Auth ： gc
"""
import akshare as ak
import datetime


def get_hs300_financial_report(date = datetime.datetime.now().strftime("%Y%m%d")):
    now = datetime.datetime.now()
    while True:
        try:
            stock_yjbb_em_df = ak.stock_yjbb_em(date=now.strftime("%Y%m%d"))
            stock_yjbb_em_df.to_excel("./data/financial_report_data/hs300_financial_report_{}.xlsx".format(now.strftime("%Y%m%d")), index=False)
            if int(now.strftime("%Y%m%d"))<=date:
                break
        except Exception as e:
            pass
        finally:
            delta = datetime.timedelta(days = 1)
            now = now - delta